﻿using System.Collections.Generic;
using SW.Lite.Infrastructure.Common;
using SW.Lite.Model.Master;

namespace SW.Lite.IDAL.Master
{
    public interface IMenu
    {
        /// <summary>
        ///     数据是否存在
        /// </summary>
        /// <param name="id"></param>
        bool Exists(int id);

        /// <summary>
        ///     获取单个项
        /// </summary>
        /// <param name="id"></param>
        MenuModel Single(int id);

        /// <summary>
        ///     获取所有项目
        /// </summary>
        PageList<MenuModel> All();

        /// <summary>
        ///     获取父菜单下的菜单列表
        /// </summary>
        /// <param name="parentId">父菜单ID</param>
        /// <param name="pageIndex">页索引</param>
        /// <param name="pageSize">页大小</param>
        PageList<MenuModel> All(int parentId, int pageIndex, int pageSize);

        /// <summary>
        ///     插入数据
        /// </summary>
        ExecuteResult Insert(MenuModel item);

        /// <summary>
        ///     更新数据
        /// </summary>
        ExecuteResult Update(MenuModel item);

        /// <summary>
        ///     删除数据
        /// </summary>
        /// <param name="ids"></param>
        ExecuteResult Delete(params int[] ids);

        /// <summary>
        ///     根据角色ID集合获取菜单列表
        /// </summary>
        /// <param name="roleIDs">角色ID集合</param>
        PageList<MenuModel> GetMenusByRoleIds(params int[] roleIDs);

        /// <summary>
        ///     根据菜单编码获取菜单信息
        /// </summary>
        /// <param name="code">菜单编码</param>
        MenuModel GetMenuByCode(string code);

        /// <summary>
        ///     更新菜单的排序号
        /// </summary>
        /// <param name="menuSorts">排序号</param>
        ExecuteResult UpdateSort(Dictionary<int, int> menuSorts);
    }
}